From: Owen W. Taylor Date: Thu, 3 Feb 2011 03:54:33 +0000 (-0500) Subject: Handle changes in window position for workspace thumbnails X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~9084 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=7496a7ff3ba8e5a9c26c23db91dadb014981b77c;p=gnome-shell.git Handle changes in window position for workspace thumbnails Connect to the 'position-set' signal of MetaWindowActor and move actors when the source windows move. https://bugzilla.gnome.org/show_bug.cgi?id=640996 --- diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js index e4bd6bbff..7e46a2860 100644 --- a/js/ui/workspaceThumbnail.js +++ b/js/ui/workspaceThumbnail.js @@ -21,13 +21,17 @@ function WindowClone(realWindow) { WindowClone.prototype = { _init : function(realWindow) { this.actor = new Clutter.Clone({ source: realWindow.get_texture(), - reactive: true, - x: realWindow.x, - y: realWindow.y }); + reactive: true }); this.actor._delegate = this; this.realWindow = realWindow; this.metaWindow = realWindow.meta_window; + this._positionChangedId = this.realWindow.connect('position-changed', + Lang.bind(this, this._onPositionChanged)); + this._realWindowDestroyedId = this.realWindow.connect('destroy', + Lang.bind(this, this._disconnectRealWindowSignals)); + this._onPositionChanged(); + this.actor.connect('button-release-event', Lang.bind(this, this._onButtonRelease)); @@ -56,7 +60,26 @@ WindowClone.prototype = { this.actor.destroy(); }, + _onPositionChanged: function() { + let rect = this.metaWindow.get_outer_rect(); + this.actor.set_position(this.realWindow.x, this.realWindow.y); + }, + + _disconnectRealWindowSignals: function() { + if (this._positionChangedId != 0) { + this.realWindow.disconnect(this._positionChangedId); + this._positionChangedId = 0; + } + + if (this._realWindowDestroyedId != 0) { + this.realWindow.disconnect(this._realWindowDestroyedId); + this._realWindowDestroyedId = 0; + } + }, + _onDestroy: function() { + this._disconnectRealWindowSignals(); + this.actor._delegate = null; if (this.inDrag) {